<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateUserTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('user', function (Blueprint $table) {

            $table->increments('id');
            $table->string('username',100);
            $table->string('password',255);
            $table->string('email',255)->nullable();
            $table->string('address',255)->nullable();
            $table->string('phone',11);
            $table->timestamp('add_time')->default(DB::raw('CURRENT_TIMESTAMP'));
            $table->string('name',255)->nullable();
            $table->string('nickname',255);

            $table->string('inviter',50)->nullable();
            $table->integer('pid')->default(0);
            $table->text('path')->nullable();
            $table->integer('path_long')->default(0);
            $table->dateTime('updated_at')->nullable();
            $table->decimal('fil',12,4)->default(0)->comment('fil奖励');
            $table->decimal('red',12,4)->default(0)->comment('算力奖励');
            $table->tinyInteger('level')->default(0)->comment('0 0，1F1，2F2，3F3,4F4,5F5');
            $table->tinyInteger('level_lock')->default(0)->comment('被锁定1');
            $table->tinyInteger('state')->default(1);
            $table->tinyInteger('state_lock')->default(0)->comment('被锁定1');
            $table->integer('performance')->default(0);
            $table->integer('capacity')->default(0);
            $table->string('bank_name',50)->default('')->comment('银行名称');
            $table->string('bank_account',50)->default('')->comment('银行账户');
            $table->string('bank_legal',50)->default('')->comment('银行法人');
            $table->engine = 'InnoDB';
            $table->charset = 'utf8';
            $table->collation = 'utf8_unicode_ci';
        });

    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
//        Schema::table('user', function (Blueprint $table) {
//            //
//        });
    }
}
